<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<center>
<body>
<a href="{:url('index/fux1/add')}">添加</a>
       <table border="1">
           <thead>
           <tr>
               <td>编号</td>
               <td>姓名</td>
               <td>电话</td>
               <td>地址</td>
               <td>操作</td>
           </tr>
           </thead>
          <tbody>
          <?php foreach ($data as $key => $val): ?>
              <td><?php echo $val['id'] ?></td>
              <td><?php echo $val['name'] ?></td>
              <td><?php echo $val['number'] ?></td>
              <td><?php echo $val['article'] ?></td>
              <td><button id="<?php echo $val['id']?>" class="del">删除</button></td>
          </tr>
          <?php endforeach ?>
          </tbody>
       </table>
</body>
</html>
</center>
<script type="text/javascript" src="__STATIC__/js/jquery-2.1.4.min.js"></script>
<script>
    $(document).on("click",'.del',function () {
        var id=$(this).attr('id');
        $.ajax({
            url:"del",
            data:{id:id},
            dataType:"json",
            type:"post",
            success:function (msg) {
                if(msg==1){
                    location.reload();
                }else{
                    alert("删除失败");
                }
            }
        })
    })
</script>